<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="../../static/BOSGeo/BOSGeo.css" />
  <title>画线</title>
  <style>
    html {
      font-size: 12px;
    }

    html,
    body,
    #mapContainer {
      height: 100%;
      width: 100%;
      padding: 0;
      margin: 0;
    }

  </style>
</head>

<body>
  <div id="mapContainer"></div>
  <button style="position: absolute;left: 20px;top: 20px;" id="drawLine">开始画</button>
  <script src="../../static/BOSGeo/BOSGeo.js"></script>
  <script>
    var map = new BOSGeo.Map('mapContainer', {
    mapType: BOSGeo.TDT_IMAGERY
    });

    var draw = new BOSGeo.Drawer();

    var tool = document.querySelector('#drawLine');
    tool.addEventListener('click', function () {
        draw.startDraw({type: 'polyline', style: {
                lineType: 'solid',
                color: '#f50955',
                opacity: 1,
                width: 3,
                outline: false,
                outlineColor: '#0e3dc1',
                outlineWidth: 2,
                clampToGround: false
            }})// 自定义样式
    })

    map.viewFix(121.4658, 31.16493, 1000, {
    heading: 283.40944,
    pitch: -84.58174,
    roll: 178.23488
})
  </script>
</body>

</html>